Function Reference

_TS_TaskGet

Returns the Task or Task Definition object of the specified Task.

#Include <TaskScheduler.au3>
_TS_TaskGet($oService, $sTaskPath[, $bReturnFlag = 0])

 

Parameters

$oService Task Scheduler Service object as returned by _TS_Open
$sTaskPath Task path (Folder plus Task name) to process
$bReturnFlag [optional] Set to 1 if the function should return the Task.Definition object (default = Task object)

 

Return Value

Success: Object of the Task
Failure: Returns 0 and sets @error:
    1601 - Error accessing the specified Taskfolder. @extended is set to the COM error code
    1602 - Error retrieving the Tasks collection. @extended is set to the COM error code
    1603 - Task with the specified name could not be found in the Task Folder

 

Remarks

None.

 

Related

 

Example


#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=y
#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <TaskScheduler.au3>

; *****************************************************************************
; Connect to the Task Scheduler Service
; *****************************************************************************
Global $oService = _TS_Open()
If @error <> 0 Then Exit MsgBox($MB_ICONERROR, "Task Scheduler UDF", "Error connecting to the Task Scheduler Service. @error = " & @error & ", @extended = " & @extended & @CRLF & @CRLF & _TS_ErrorText(@error))

; *****************************************************************************
; Connect to a single Task and show some Properties
; *****************************************************************************
Global $oTask = _TS_TaskGet($oService, "\Microsoft\Windows\Device Information\Device")
If Not @error Then
    MsgBox($MB_ICONINFORMATION, "_TS_TaskGet", "Task found:" & @CRLF & "  Name: " & $oTask.Name & @CRLF & "  Path: " & $oTask.Path)
Else
    MsgBox($MB_ICONERROR, "_TS_TaskGet", "Returned @error=" & @error & ", @extended=" & @extended & @CRLF & @CRLF & _TS_ErrorText(@error))
EndIf
_TS_Close()